class CreateDeals < ActiveRecord::Migration
  def self.up
    create_table :deals, :primary_key => "deal_id"  do |table|
      table.column :num, :integer, :null => false
      table.column :event_id, :integer, :null => false
      table.column :res, :integer, :null => false
      table.column :ns_id, :integer, :null => false # FK pairs
      table.column :ew_id, :integer, :null => false # FK pairs
    end
#    execute "      
#      ALTER TABLE deals ADD FOREIGN KEY (event_id) REFERENCES events (event_id);
#      ALTER TABLE deals ADD FOREIGN KEY (ns_id) REFERENCES pairs (pair_id);
#      ALTER TABLE deals ADD FOREIGN KEY (ew_id) REFERENCES pairs (pair_id);           
#    "          
  end

  def self.down
    drop_table :deals
  end
end
